new Vue({
    el: "#container",
    data() {
        return {
            // 查询数据
            initIndentId: null,
            tableSearch: {
                pageIndex: 0,
                limit: 50,
                total: 0,
                dateFormat: "yyyy-MM-dd HH:mm",
                startTime: null,
                endTime: null,
                searchVal: null,
                searchVal2:null,
                isAdd: -1,
                createType: null,
            },
            //  表数据
            tableDatas: [],
            tableLoading: false,
            //  弹窗数据
            dialog: {
                title: "",
                show: false,
                loading: false,
                //  是否为更新数据
                update: false,
            },
            //  任务单搜索框
            dialogSearch: {
                conName: null,
                site: null,
                loading: null,
            },
            //  任务单的泵送设备
            indentPumpDevs: [],
            //  发货单表单
            invoiceForm: {
                id: null,
                url: "",
                indentPopover: false,
                //  上传的数据
                render: {
                    indentId: null,
                    createType: '1',
                    invoiceType: '0',
                    sendStere: null,
                    mixId: null,
                    proTime: null,
                    isAdd: "0",
                    dispatcher: null,
                    mixUser: null,
                    dispatcherName: null,
                    mixUserName: null,
                    carId: null,
                    driverId: null,
                    driver: null,
                    calcTranStere: "0",
                    receiptType: null,
                    specialClearType: null,
                    roadType: null,
                    remark: null,
                    tranRemark: null,
                    pumpRemark: null,
                    pumpDeviceId: null,
                    totalCar: 0,
                    totalStere: 0,
                },
                //  仅用于展示的数据
                exhibition: {
                    conName: null,
                    clientName: null,
                    builder: null,
                    site: null,
                    strengthName: null,
                    slumps: null,
                    tech: null,
                    castModelName: null,
                    indentCode: null,
                    //  从后台取出的累计方量数据
                    totalStere: 0,
                },
            },
            //  发货单验证规则
            invoiceRules: {
                //  上传数据
                render: {
                    indentId: [
                        {required: true, message: '请选择任务单', trigger: 'blur'},
                    ],
                    createType: [
                        {required: true, message: '请选择生产方式', trigger: 'blur'},
                    ],
                    invoiceType: [
                        {required: true, message: '请选择发货方式', trigger: 'blur'},
                    ],
                    sendStere: [
                        {required: true, message: '请输入发货方量', trigger: 'blur'},
                    ],
                    totalCar: [
                        {required: true, message: '请输入累计车次', trigger: 'blur'},
                    ],
                    totalStere: [
                        {required: true, message: '请输入累计方量', trigger: 'blur'},
                    ],
                    proTime: [
                        {required: true, message: '请选择生产时间', trigger: 'blur'},
                    ],
                    /*isAdd: [
                        {required: true, message: '请选择是否累计', trigger: 'blur'},
                    ],*/
                    dispatcherName: [
                        {required: true, message: '请选择调度员', trigger: 'blur'},
                    ],
                    mixUserName: [
                        {required: true, message: '请选择拌台操作员', trigger: 'blur'},
                    ],
                    carId: [
                        {required: true, message: '请选择运输车辆', trigger: 'blur'},
                    ],
                    calcTranStere: [
                        {required: true, message: '请选择是否计算运输方量', trigger: 'blur'},
                    ],
                },
            },
            //  任务单列表
            indentList: [],
            //  生产方式
            createTypeList: [],
            //  票据类型
            billTypeList: [],
            //  发货类型
            invoiceTypeList: [],
            //  生产线列表
            mixList: [],
            //  车辆列表
            carList: [],
            //  正常的车辆
            normalCarList: [],
            //  配额票的车辆
            quotaCarList: [],
            //  调度员列表
            dispatcherList: [],
            // 操作员列表
            mixUserList: [],
            //  票据类型
            receiptTypeList: [],
            //  特殊结算类型
            specialClearTypeList: [],
            //  道路类型
            roadTypeList: [],
            //  发货单处理记录
            handleList: [],
            //  详情数据
            detailDialog: {
                show: false,
                invoiceId: false,
            },
            //  转料
            tranDialog: {
                show: false,
            },
            //  分车转料
            splitDialog: {
                show: false,
            },
            tranSourceInvoice: null,
            //  消耗记录
            invExpendDialog: {
                show: false,
                id: null,
            },
            //  司机列表
            driverList: [],
            chooseCar: null,
            chooseDriver: null,
        }
    },
    // 在模板渲染成html前调用
    created() {
        var that = this;
        if (!isNull(initIndentId)) {
            that.initIndentId = initIndentId;
            that.tableSearch.indentId = initIndentId;
        }
        that.loadBaseDatas();
        that.loadCarList();
        that.loadQuotaCarList();
        that.loadLineList();
        that.loadDispatcherList();
        that.loadMixUserList();
        that.loadTableDatas();
    },
    // 在模板渲染成html后调用，通常是初始化页面完成后，再对html的dom节点进行一些需要的操作
    mounted() {
        var that = this;
    },
    methods: {
        //  加载各个基础数据
        loadBaseDatas() {
            let that = this;
            $.ajax({
                type: "POST",
                url: "/pro/invoice/base/datas",
                async: true,
                dataType: 'json',
                data: {},
                success: function (res) {
                    if (res.code == 0) {
                        let map = res.data;
                        that.billTypeList = map.billTypeList;
                        that.createTypeList = map.createTypeList;
                        that.invoiceTypeList = map.invoiceTypeList;
                        that.receiptTypeList = map.receiptTypeList;
                        that.specialClearTypeList = map.specialClearTypeList;
                        that.roadTypeList = map.roadTypeList;
                    } else {
                        that.$message({
                            showClose: true,
                            message: '查询泵送设备失败：' + res.msg,
                            type: 'error'
                        });
                    }
                },
                error: function (res) {
                    that.$message({
                        showClose: true,
                        message: '请求失败，请联系管理员',
                        type: 'error'
                    });
                    return;
                },
                complete: function (XMLHttpRequest, status) {
                    // that.tableLoading = false;
                }
            })
        },
        //  加载生产线
        loadLineList() {
            let that = this;
            $.ajax({
                type: "POST",
                url: "/sys/line/list",
                async: true,
                dataType: 'json',
                data: {},
                success: function (res) {
                    if (res.code == 0) {
                        that.mixList = res.data;
                    } else {
                        that.$message({
                            showClose: true,
                            message: '查询生产线信息失败：' + res.msg,
                            type: 'error'
                        });
                    }
                },
                error: function (res) {
                    that.$message({
                        showClose: true,
                        message: '请求生产线信息失败，请联系管理员',
                        type: 'error'
                    });
                    return;
                },
                complete: function (XMLHttpRequest, status) {
                }
            })
        },
        //  加载车辆
        loadCarList() {
            let that = this;
            $.ajax({
                type: "POST",
                url: "/pro/tran/car/list",
                async: true,
                dataType: 'json',
                data: {
                    re: 1,
                },
                success: function (res) {
                    if (res.code == 0) {
                        that.carList = res.data;
                        that.normalCarList = res.data;
                    } else {
                        that.$message({
                            showClose: true,
                            message: '查询车辆列表失败：' + res.msg,
                            type: 'error'
                        });
                    }
                },
                error: function (res) {
                    that.$message({
                        showClose: true,
                        message: '请求车辆列表失败，请联系管理员',
                        type: 'error'
                    });
                    return;
                },
                complete: function (XMLHttpRequest, status) {
                }
            })
        },
        //  加载调度人员
        loadDispatcherList() {
            //  加载拌台操作员
            let that = this;
            $.ajax({
                type: "POST",
                url: "/sys_user/dispatcher/list",
                async: true,
                dataType: 'json',
                data: {},
                success: function (res) {
                    if (res.code == 0) {
                        that.dispatcherList = res.data;
                    } else {
                        that.$message({
                            showClose: true,
                            message: '查询调度员列表失败：' + res.msg,
                            type: 'error'
                        });
                    }
                },
                error: function (res) {
                    that.$message({
                        showClose: true,
                        message: '请求调度员列表失败，请联系管理员',
                        type: 'error'
                    });
                    return;
                },
                complete: function (XMLHttpRequest, status) {
                }
            })
        },
        //  加载拌台操作员
        loadMixUserList() {
            let that = this;
            $.ajax({
                type: "POST",
                url: "/sys_user/mixer/list",
                async: true,
                dataType: 'json',
                data: {},
                success: function (res) {
                    if (res.code == 0) {
                        that.mixUserList = res.data;
                    } else {
                        that.$message({
                            showClose: true,
                            message: '查询拌台操作员列表失败：' + res.msg,
                            type: 'error'
                        });
                    }
                },
                error: function (res) {
                    that.$message({
                        showClose: true,
                        message: '请求查询拌台操作员失败，请联系管理员',
                        type: 'error'
                    });
                    return;
                },
                complete: function (XMLHttpRequest, status) {
                }
            })
        },
        searchDatas() {
            let that = this;
            that.tableSearch.pageIndex = 0;
            that.tableSearch.limit = 50;
            that.loadTableDatas();
        },
        // 加载数据
        loadTableDatas: function () {
            let that = this;
            that.tableLoading = true;
            $.ajax({
                type: "POST",
                url: "/pro/invoice/page",
                async: true,
                dataType: 'json',
                data: that.tableSearch,
                success: function (res) {
                    if (res.code == 0) {
                        let page = res.data;
                        that.tableDatas = page.records;
                        that.tableSearch.total = page.total;
                    } else {
                        that.$message({
                            showClose: true,
                            message: '查询发货单失败：' + res.msg,
                            type: 'error'
                        });
                    }
                },
                error: function (res) {
                    that.$message({
                        showClose: true,
                        message: '请求失败，请联系管理员',
                        type: 'error'
                    });
                    return;
                },
                complete: function (XMLHttpRequest, status) {
                    that.tableLoading = false;
                }
            })
        },
        //  任务单变动
        indentChange(indentId) {
            let that = this;
            that.invoiceForm.render.indentId = indentId;
            //  任务单变动后,查询该任务单的累计车次和方量
            $.ajax({
                type: "POST",
                url: "/pro/indent/queryTotal",
                async: true,
                dataType: 'json',
                data: {
                    indentId: indentId,
                },
                success: function (res) {
                    if (res.code == 0) {
                        let totalData = res.data;
                        let totalCar = totalData.totalCar;
                        totalCar = parseInt(totalCar) + 1;
                        that.invoiceForm.render.totalCar = totalCar;
                        that.invoiceForm.render.totalStere = totalData.totalStere;
                        that.invoiceForm.exhibition.totalStere = totalData.totalStere;
                    } else {
                        that.$message({
                            showClose: true,
                            message: '查询任务单累计数据失败：' + res.msg,
                            type: 'error'
                        });
                    }
                },
                error: function (res) {
                    return;
                },
                complete: function (XMLHttpRequest, status) {
                    that.dialog.loading = false;
                }
            })
        },
        //  显示新增发货单弹窗
        showAddDialog() {
            let that = this;
            that.dialog.show = true;
            //  加载任务单列表
            that.invoiceForm.render.createType = "1";
            that.invoiceForm.render.invoiceType = "0";
            that.invoiceForm.render.isAdd = "0";
            that.invoiceForm.render.calcTranStere = "0";
            that.invoiceForm.url = "/pro/invoice/add-hand";
            setTimeout(function () {
                that.$refs["invoiceForm"].clearValidate();
                that.dialog.update = false;
            }, 10);
            //
        },
        //  显示修改弹窗
        showEditDialog(item) {
            let that = this;
            that.dialog.title = "修改发货单";
            that.dialog.show = true;
            that.dialog.update = true;
            that.invoiceForm = {
                id: item.id,
                url: "/pro/invoice/update/" + item.id,
                //  上传的数据
                render: {
                    indentId: item.indentId,
                    createType: item.createType == null ? null : item.createType + "",
                    invoiceType: item.invoiceType == null ? null : item.invoiceType + "",
                    sendStere: item.sendStere,
                    mixId: item.mixId,
                    proTime: item.proTime,
                    isAdd: item.isAdd == null ? null : item.isAdd + "",
                    dispatcher: item.dispatcher,
                    mixUser: item.mixUser,
                    dispatcherName: item.dispatcherName,
                    mixUserName: item.mixUserName,
                    carId: item.carId,
                    driver: item.driver,
                    driverId: item.driverId,
                    calcTranStere: item.calcTranStere == null ? null : item.calcTranStere + "",
                    receiptType: item.receiptType == null ? null : item.receiptType + "",
                    specialClearType: item.specialClearType == null ? null : item.specialClearType + "",
                    roadType: item.roadType == null ? null : item.roadType + "",
                    remark: item.remark,
                    tranRemark: item.tranRemark,
                    pumpRemark: item.pumpRemark,
                    pumpDeviceId: item.pumpDevice,
                    totalCar: item.totalCar,
                    totalStere: item.totalStere,
                },
                //  仅用于展示的数据
                exhibition: {
                    conName: item.conName,
                    clientName: item.clientName,
                    builder: item.builder,
                    site: item.site,
                    strengthName: item.strengthName,
                    slumps: item.slumps,
                    tech: item.tech,
                    castModelName: item.castModelName,
                    indentCode: item.indentCode,
                    createTypeTxt: item.createTypeTxt,
                    totalStere: item.totalStere,
                },
            };
            that.chooseCar = {
                id: item.carId,
            };
            that.driverList = [{
                id: item.driverId,
                name: item.driver,
            }];
            that.chooseDriver = {
                id: item.driverId,
                name: item.driver,
            }
            that.loadIndentPumpDevs('invoiceForm', item.pumpDevice);
        },
        //  提交表单
        onSubmit(formName) {
            let that = this;
            // console.log(that.invoiceForm.render);
            that.$refs[formName].validate((valid, error) => {
                if (valid) {
                    //  验证成功
                    that.dialog.loading = true;
                    $.ajax({
                        type: "PUT",
                        url: that.invoiceForm.url,
                        async: true,
                        dataType: 'json',
                        data: that.invoiceForm.render,
                        success: function (res) {
                            if (res.code == 0) {
                                that.$message({
                                    showClose: true,
                                    message: '操作成功',
                                    type: 'success'
                                });
                                that.loadTableDatas();
                                that.cancel('invoiceForm', 'dialog');
                            } else {
                                that.$message({
                                    showClose: true,
                                    message: '保存失败：' + res.msg,
                                    type: 'error'
                                });
                            }
                        },
                        error: function (res) {
                            that.$message({
                                showClose: true,
                                message: '请求失败，请联系管理员',
                                type: 'error'
                            });
                            return;
                        },
                        complete: function (XMLHttpRequest, status) {
                            that.dialog.loading = false;
                        }
                    })
                } else {
                    let msg = error[Object.keys(error)[0]][0].message;
                    that.$message({
                        showClose: true,
                        message: '验证表单失败:' + msg,
                        type: 'error'
                    });
                    return false;
                }
            });
        },
        //  调度人员变动
        dispatcherChange(item) {
            let that = this;
            that.invoiceForm.render.dispatcher = item.id;
            that.invoiceForm.render.dispatcherName = item.name;
        },
        mixUserChange(item) {
            let that = this;
            that.invoiceForm.render.mixUser = item.id;
            that.invoiceForm.render.mixUserName = item.name;
        },
        /**
         * 显示转料弹窗
         * @param invoice
         */
        showTranDialog(invoice) {
            let that = this;
            if (invoice == null) {
                that.$message({
                    showClose: true,
                    message: '请选择正确的发货单',
                    type: 'error'
                });
                return;
            }
            that.tranSourceInvoice = invoice;
            that.tranDialog.show = true;
        },
        //  显示分车转料弹窗
        showSplitDialog(invoice) {
            let that = this;
            if (invoice == null) {
                that.$message({
                    showClose: true,
                    message: '请选择正确的发货单',
                    type: 'error'
                });
                return;
            }
            that.tranSourceInvoice = invoice;
            that.splitDialog.show = true;
        },
        //  取消添加
        cancel(fromName, dialogName) {
            let that = this;
            let render = that[fromName].render;
            Object.keys(render).forEach(key => {
                render[key] = null;
            });
            Object.keys(that[fromName].exhibition).forEach(key => {
                that[fromName].exhibition[key] = null;
            });
            that.chooseCar = null;
            that.chooseDriver = null;
            that[fromName].id = null;
            that[dialogName].show = false;
            that.$refs[fromName].clearValidate();

        },
        //  关闭弹窗
        closeTranDialog() {
            let that = this;
            that.tranDialog.show = false;
            that.splitDialog.show = false;
            // that.loadTableDatas();
        },
        //  作废发货单
        scrapInvoice(invoiceId) {
            let that = this;
            this.$prompt('', '请输入作废原因', {
                confirmButtonText: '确定',
                cancelButtonText: '取消',
                center: true
            }).then(({value}) => {
                that.tableLoading = true;
                $.ajax({
                    type: "DELETE",
                    url: "/pro/invoice/scrap/" + invoiceId,
                    async: true,
                    dataType: 'json',
                    data: {
                        remark: value,
                    },
                    success: function (res) {
                        if (res.code == 0) {
                            that.$message({
                                showClose: true,
                                message: '作废成功',
                                type: 'success'
                            });
                            that.loadTableDatas();
                        } else {
                            that.$message({
                                showClose: true,
                                message: '作废失败：' + res.msg,
                                type: 'error'
                            });
                        }
                    },
                    error: function (res) {
                        that.$message({
                            showClose: true,
                            message: '请求失败，请联系管理员',
                            type: 'error'
                        });
                        return;
                    },
                    complete: function (XMLHttpRequest, status) {
                        that.tableLoading = false;
                    }
                })
            }).catch(() => {
                this.$message({
                    type: 'info',
                    message: '取消作废操作'
                });
            });
        },
        /**
         * 查询发货单的消耗记录
         * @param invoice
         */
        showExpendDialog(invoice) {
            let that = this;
            that.invExpendDialog.show = true;
            that.invExpendDialog.invoice = invoice;
        },
        /**
         * 加载泵送设备
         */
        loadIndentPumpDevs(fromName, deviceId) {
            let that = this;
            let indentId = that[fromName].render.indentId
            $.ajax({
                type: "POST",
                url: "/pro/indent/pump-dev-list",
                async: true,
                dataType: 'json',
                data: {
                    indentId: indentId,
                },
                success: function (res) {
                    if (res.code == 0) {
                        that.indentPumpDevs = res.data;
                        if (deviceId == -1) {
                            //  默认
                            if (that.indentPumpDevs.length > 0) {
                                that[fromName].render.pumpDeviceId = that.indentPumpDevs[0].id;
                            }
                        } else {
                            that[fromName].render.pumpDeviceId = deviceId;
                        }
                    } else {
                        that.$message({
                            showClose: true,
                            message: "查询泵送设备失败" + res.msg,
                            type: 'error'
                        });
                    }
                },
                error: function (res) {
                    that.$message({
                        showClose: true,
                        message: '请求失败，请联系管理员',
                        type: 'error'
                    });
                    return;
                },
                complete: function (XMLHttpRequest, status) {
                }
            });
        },
        /**
         * 显示发货单详情
         * @param invoiceId
         */
        showInvDetail(invoiceId) {
            let that = this;
            that.detailDialog.show = true;
            that.detailDialog.invoiceId = invoiceId;
        },
        printInvoice(invoiceId) {
            let that = this;
            $.ajax({
                type: "POST",
                url: "/pro/dispatch/print/" + invoiceId,
                async: true,
                data: {},
                success: function (res) {
                    if (res.code == 0) {
                        that.$message({
                            showClose: true,
                            message: '开始打印',
                            type: 'success'
                        });
                    } else {
                        that.$message({
                            showClose: true,
                            message: '打印失败:' + res.msg,
                            type: 'error'
                        });
                    }
                },
                error: function (res) {
                    return;
                },
                complete: function (XMLHttpRequest, status) {
                }
            })
        },
        /**
         * 恢复发货单
         * @param invoiceId
         */
        restoreInvoice(invoiceId) {
            let that = this;
            this.$prompt('', '请输入恢复原因', {
                confirmButtonText: '确定',
                cancelButtonText: '取消',
                center: true
            }).then(({value}) => {
                that.tableLoading = true;
                $.ajax({
                    type: "PUT",
                    url: "/pro/invoice/scrap/restore/" + invoiceId,
                    async: true,
                    dataType: 'json',
                    data: {
                        remark: value,
                    },
                    success: function (res) {
                        if (res.code == 0) {
                            that.$message({
                                showClose: true,
                                message: '操作成功',
                                type: 'success'
                            });
                            that.loadTableDatas();
                        } else {
                            that.$message({
                                showClose: true,
                                message: '操作失败：' + res.msg,
                                type: 'error'
                            });
                        }
                    },
                    error: function (res) {
                        that.$message({
                            showClose: true,
                            message: '请求失败，请联系管理员',
                            type: 'error'
                        });
                        return;
                    },
                    complete: function (XMLHttpRequest, status) {
                        that.tableLoading = false;
                    }
                })
            }).catch(() => {
                this.$message({
                    type: 'info',
                    message: '取消操作'
                });
            });
        },
        uploadCarChange(car) {
            let that = this;
            //  设置车辆
            that.invoiceForm.render.carId = car.id;
            that.chooseCar = car;
            let driverId = car.driverId;
            if (driverId != null) {
                that.driverList = [{
                    id: driverId,
                    name: car.driver,
                }];
            } else {
                that.driverList = [];
            }
            //  清空选择的司机数据
            that.chooseDriver = null;
            that.invoiceForm.render.driverId = null;
            that.invoiceForm.render.driver = null;
        },
        uploadDriver(driver) {
            let that = this;
            that.chooseDriver = driver;
            if (driver !== null && typeof driver === 'object') {
                that.invoiceForm.render.driverId = driver.id;
                that.invoiceForm.render.driver = driver.name;
            } else {
                that.invoiceForm.render.driverId = -1;
                that.invoiceForm.render.driver = driver;
            }
        },
        /**
         * 重置发货单的消耗
         */
        resetExpend(invoice) {
            let that = this;
            let invoiceId = invoice.id;
            that.tableLoading = true;
            $.ajax({
                type: "PUT",
                url: "/pro/invoice/reset/expend/" + invoiceId,
                async: true,
                dataType: 'json',
                success: function (res) {
                    if (res.code == 0) {
                        that.$message({
                            showClose: true,
                            message: '操作成功,请稍后查看消耗数据',
                            type: 'success'
                        });
                        that.loadTableDatas();
                    } else {
                        that.$message({
                            showClose: true,
                            message: '操作失败：' + res.msg,
                            type: 'error'
                        });
                    }
                },
                error: function (res) {
                    that.$message({
                        showClose: true,
                        message: '请求失败，请联系管理员',
                        type: 'error'
                    });
                    return;
                },
                complete: function (XMLHttpRequest, status) {
                    that.tableLoading = false;
                }
            })
        },
        //  转料处理
        handleTran(tranType, invoice) {
            let that = this;
            if (tranType == 0) {
                //  整车转料
                that.showTranDialog(invoice);
            } else if (tranType == 1) {
                //  分车转料
                that.showSplitDialog(invoice);
            } else {
                //  转料类型错误
                that.$message({
                    showClose: true,
                    message: '转料类型错误',
                    type: 'error'
                });
            }
        },
        // 修改每页数据
        handleSizeChange(val) {
            var that = this;
            that.tableSearch.limit = val;
            // 查询数据
            that.loadTableDatas();
        },
        handleCurrentChange(val) {
            // 设置页数
            var that = this;
            that.tableSearch.pageIndex = val;
            that.loadTableDatas();
        },
        /**
         * 发货单类型
         * @param item
         */
        invoiceTypeChange(item) {
            let that = this;
            //  除了砼和润管砂浆应该不选方量生产线，操作工，方量和运输方量自动不累计
            if (item != 0 && item != 1) {
                that.invoiceForm.render.isAdd = "1";
                that.invoiceForm.render.calcTranStere = "1";
            } else {
                that.invoiceForm.render.isAdd = "0";
                that.invoiceForm.render.calcTranStere = "0";
            }
        },
        //  发货方量变更
        sendStereChange() {
            let that = this;
            //  发货方量
            let sendStere = that.invoiceForm.render.sendStere;
            //  累计方量
            let oldStere = that.invoiceForm.exhibition.totalStere;
            let newTotalStere = parseFloat(sendStere) + parseFloat(oldStere);
            that.invoiceForm.render.totalStere = newTotalStere;
        },
        //  加载车辆
        loadQuotaCarList() {
            let that = this;
            $.ajax({
                type: "POST",
                url: "/pro/tran/car/quota",
                async: true,
                dataType: 'json',
                data: {},
                success: function (res) {
                    if (res.code == 0) {
                        that.quotaCarList = res.data;
                    } else {
                        that.$message({
                            showClose: true,
                            message: '查询车辆列表失败：' + res.msg,
                            type: 'error'
                        });
                    }
                },
                error: function (res) {
                    that.$message({
                        showClose: true,
                        message: '请求车辆列表失败，请联系管理员',
                        type: 'error'
                    });
                    return;
                },
                complete: function (XMLHttpRequest, status) {
                }
            })
        },
        //  发货单的创建方式改变了,
        createTypeChange(item) {
            let that = this;
            let createType = item;
            createType = parseInt(createType);
            //  清空车辆选择数据
            that.chooseCar = {};
            if (createType == 2) {
                //  配额票,选择配额车辆
                that.carList = that.quotaCarList;
            } else {
                //  手动票,正常车辆
                that.carList = that.normalCarList;
            }
        }
    }
})
